<?php $this -> load -> view('header'); ?>
<!-- BEGIN CONTAINER -->
<div class="page-container row-fluid">
	<?php $this -> load -> view('sidebar'); ?>
	<!-- BEGIN PAGE -->
	<div class="page-content">
		<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
		<div id="portlet-config" class="modal hide">
			<div class="modal-header">
				<button data-dismiss="modal" class="close" type="button"></button>
				<h3>portlet Settings</h3>
			</div>
			<div class="modal-body">
				<p>
					Here will be a configuration form
				</p>
			</div>
		</div>
		<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
		<!-- BEGIN PAGE CONTAINER-->
		<div class="container-fluid">
			<!-- BEGIN PAGE HEADER-->
			<div class="row-fluid">
				<div class="span12">
					<!-- BEGIN STYLE CUSTOMIZER -->
					<div class="color-panel hidden-phone">
						<div class="color-mode-icons icon-color"></div>
						<div class="color-mode-icons icon-color-close"></div>
						<div class="color-mode">
							<p>
								THEME COLOR
							</p>
							<ul class="inline">
								<li class="color-black current color-default" data-style="default"></li>
								<li class="color-blue" data-style="blue"></li>
								<li class="color-brown" data-style="brown"></li>
								<li class="color-purple" data-style="purple"></li>
								<li class="color-white color-light" data-style="light"></li>
							</ul>
							<label class="hidden-phone">
								<input type="checkbox" class="header" checked value="" />
								<span class="color-mode-label">Fixed Header</span> </label>
						</div>
					</div>
					<!-- END BEGIN STYLE CUSTOMIZER -->
					<h3 class="page-title"> Katalog <small>Barang</small></h3>
					<?php $this -> load -> view('breadcrumb'); ?>
				</div>
			</div>
			<!-- END PAGE HEADER-->
			<!-- BEGIN PAGE CONTENT-->
			<div class="row-fluid">
				<div class="span12">
					<div class="tabbable tabbable-custom boxless">
						<ul class="nav nav-tabs">
							<li class="active">
								<a class="advance_form_with_chosen_element" href="#tab_1" data-toggle="tab">Barang Info</a>
							</li>
							
						</ul>
						<div class="tab-content">
							<div class="tab-pane active" id="tab_1">
								<!-- BEGIN FORM-->
								<form action="<?php echo base_url()?>katalog/saveBarang" method="post" class="form-horizontal">
								<div class="portlet box green">
									<div class="portlet-title">
										<h4><i class="icon-reorder"></i>Form Add New Barang</h4>
										<div class="tools">
											<a href="javascript:;" class="collapse"></a>
											<a href="#portlet-config" data-toggle="modal" class="config"></a>
											<a href="javascript:;" class="reload"></a>
											<a href="javascript:;" class="remove"></a>
										</div>
									</div>
									<div class="portlet-body form">
										
											<input type="hidden" name="Barang.id" value="<?php echo $id?>"/>
											<h3 class="form-section">Info Barang</h3>
											<div class="row-fluid">
												<!--/span-->
												<div class="span6 ">
													<div class="control-group">
														<label class="control-label">Kode Barcode</label>
														<div class="controls">
															<input type="text" class="m-wrap span12" placeholder="Kode Barcode" name="Barang.barcode" value="<?php echo ($barang!=NULL)? $barang->getBarcode():""; ?>" <?php echo ($barang!=NULL)? "readonly='readonly'" : ""; ?> >
														</div>
													</div>													
												</div>
												<!--/span-->
												
												<div class="span6 ">
													<div class="control-group">
														<label class="control-label">Nama</label>
														<div class="controls">
															<input type="text" class="m-wrap span12" placeholder="Nama Barang" name="Barang.name" value="<?php echo ($barang!=NULL)? $barang->getName():""; ?>">
														</div>
													</div>
												</div>
												
											</div>
											
											<!--/row-->
											
											<div class="row-fluid">
												<div class="span6 ">
													<div class="control-group">
														<label class="control-label">Warna</label>
														<div class="controls">
															<input type="text" class="m-wrap span12" placeholder="Warna" name="Barang.color" value="<?php echo ($barang!=NULL)? $barang->getColor():""; ?>">															
														</div>
													</div>
												</div>

												<!--/span-->
												<div class="span6">
													<div class="control-group">
														<label class="control-label">Jumlah</label>
														<div class="controls">
															<input type="text" class="m-wrap span3 onlynumber" placeholder="Jumlah" name="Barang.qty" value="<?php echo ($barang!=NULL)? $barang->getQty():""; ?>">
															&nbsp;
															<input type="text" class="m-wrap span3" placeholder="Satuan" name="Barang.unit" value="<?php echo ($barang!=NULL)? $barang->getUnit():""; ?>">																														
														</div>
													</div>													
												</div>
												<!--/span-->
											</div>

											<div class="row-fluid">
												<div class="span12">
													<div class="control-group">
														<label class="control-label">Description</label>
														<div class="controls">
															<textarea class="span12 m-wrap" rows="6" name="Barang.description"><?php echo ($barang!=NULL)? $barang->getDescription():""; ?></textarea>
														</div>
													</div>
												</div>
											</div>

											<!--/row-->

											<h3 class="form-section">Category</h3>
											<div class="row-fluid">
												<div class="span12 ">
													<div class="control-group">
														<label class="control-label">Category</label>
														<div class="controls">
															<select class="span6 chosen" data-placeholder="Choose a Category" tabindex="1" name="Barang.category">
																<?php
																foreach ($categories as $cat) {
																	if ($barang != NULL) {
																		if ($barang -> getCategory() != NULL) {
																			if ($barang -> getCategory() -> getId() == $cat -> getId()) {

																				echo '<option value="' . $cat -> getId() . '" selected="selected">' . $cat -> getName() . '</option>';
																			} else {
																				echo '<option value="' . $cat -> getId() . '" >' . $cat -> getName() . '</option>';
																			}
																		} else {
																			echo '<option value="' . $cat -> getId() . '" >' . $cat -> getName() . '</option>';
																		}
																	} else {
																		echo '<option value="' . $cat -> getId() . '" >' . $cat -> getName() . '</option>';
																	}

																}
																?>
															</select>
														</div>
													</div>
												</div>
											</div>
											<h3 class="form-section">Harga</h3>
											<div class="row-fluid">
												<!--/span-->
												<div class="span6 ">
													<div class="control-group">
														<label class="control-label">Harga Beli</label>
														<div class="controls">
															<div class="input-prepend input-append">
                                    							<span class="add-on">Rp</span>
                                    							<input type="text" class="m-wrap span12 onlynumber" placeholder="Harga Beli" name="BarangStock.price" value="<?php echo ($barang!=NULL)? $barangStock->getPrice():""; ?>" <?php echo ($barang!=NULL)? "readonly='readonly'" : ""; ?>>
                                    							<span class="add-on">.00</span>
                                 							</div>															
														</div>
													</div>													
												</div>
												<!--/span-->
												
												<div class="span6 ">
													<div class="control-group">
														<label class="control-label">Harga Jual</label>
														<div class="controls">
															<div class="input-prepend input-append">
                                    							<span class="add-on">Rp</span>
                                    							<input type="text" class="m-wrap span12 onlynumber" placeholder="Harga Jual" name="BarangPrice.price" value="<?php echo ($barang!=NULL)? $barangPrice->getPrice():""; ?>" <?php echo ($barang!=NULL)? "readonly='readonly'" : ""; ?>>
                                    							<span class="add-on">.00</span>
                                 							</div>
														</div>
													</div>
												</div>												
											</div>
											
											<div class="row-fluid">
												<!--/span-->
												<div class="span6 ">
													<div class="control-group">
														<label class="control-label">Tanggal Belanja</label>
														<div class="controls">
															<div class="input-append">
                                    							<input class="m-wrap m-ctrl-medium date-picker" size="16" type="text" name="BarangStock.stockDate" value="<?php echo ($barang!=NULL)? $barangStock->getStockDate()->format('d-m-Y'):""; ?>" <?php echo ($barang!=NULL)? "readonly='readonly'" : ""; ?>/>
                                    							<span class="add-on"><i class="icon-calendar"></i></span>
                                 							</div>															
														</div>
													</div>													
												</div>
												<!--/span-->
												
												<div class="span6 ">
												</div>												
											</div>										
									</div>
								</div>
								<div class="form-actions" >
									<label class="checkbox line">
										<?php
											if ($barang != NULL){
												echo '<input type="checkbox" value="1" name="ismore"/>';	
											} else {
												echo '<input type="checkbox" value="1" name="ismore" checked="checked"/>';
											}
										?>
		                                Centang jika ingin input lagi
                                 	</label>

									<button type="submit" class="btn blue">
										<i class="icon-ok"></i> Save
									</button>
									
									<button type="button" class="btn">
										Cancel
									</button>
								</div>
								
								<!-- END FORM-->
							</form>		
						</div>
				</div>
			</div>
		</div>
	</div>
	<!-- END PAGE CONTENT-->
</div>
<!-- END PAGE CONTAINER -->
</div>
<!-- END PAGE -->
</div>
<!-- END CONTAINER -->
<?php $this->load->view('footer')?>


